package com.javaee.spring;

import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.javaee.spring.chineseIdol.Auditorium;
import com.javaee.spring.chineseIdol.Instrumentalist;
import com.javaee.spring.chineseIdol.PerformanceException;
import com.javaee.spring.chineseIdol.Performer;
import com.javaee.spring.chineseIdol.Stage;
import com.javaee.spring.chineseIdol.SuperInstrumentalist;



public class SpringRun {

	public static void main(String[] args) {

//		ConfigurableApplicationContext ctx =
//                new ClassPathXmlApplicationContext("com/javaee/spring/chineseIdol/chinese-idol.xml");
//		Performer performer = (Performer)ctx.getBean("xiaozhang");
//		try {
//			performer.performer();
//		} catch (PerformanceException e) {
//			e.printStackTrace();
//		}
//		Stage performer = (Stage)ctx.getBean("theStage");
//		performer.show();
		
//		Auditorium performer = (Auditorium)ctx.getBean("auditorium");
//		
//		ctx.close();
		
//		AbstractApplicationContext ctx = new ClassPathXmlApplicationContext("com/javaee/spring/chineseIdol/chinese-idol.xml");
//		Auditorium performer = (Auditorium)ctx.getBean("auditorium");
//		ctx.registerShutdownHook();
//		ctx.close();
		
		
		ConfigurableApplicationContext ctx =
      new ClassPathXmlApplicationContext("com/javaee/spring/chineseIdol/chinese-idol.xml");
		SuperInstrumentalist performer = (SuperInstrumentalist)ctx.getBean("xiaoqiang");
		try {
			performer.performer();
		} catch (PerformanceException e) {
			
			e.printStackTrace();
		}
		ctx.close();
		
	}

}
